home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / zindent7.zip / ZINLINE.INC < prev    next >
Text File  |  1987-03-30  |  6KB  |  181 lines

  1.  
  2. (*******************************************************************)
  3. (*                                                                 *)
  4. (* Include File                                                    *)
  5. (* System Line Entry, v. 0930am, sun, 28.Mar.87, Glen Ellis        *)
  6. (*                                                                 *)
  7. (*******************************************************************)
  8.  
  9.  
  10. (* included with the Core Program SYSTEM.PAS,
  11. (* as an auxillary module to be modified FOR each future application.
  12. (*
  13. (* purpose:
  14. (*     accept command line parameters
  15. (*
  16. (* defaults are aimed a producing running + commented source code.
  17. (*
  18. (**)
  19.  
  20. (*------------------------------------------------------*)
  21.  
  22. BEGIN (* INCLUDE FILE *)
  23.  
  24.    IF paramcount > 0
  25.    then
  26.    begin
  27.  
  28.       (*---> #1 parameter *)
  29.  
  30.       SysInFilename   := paramstr(1);
  31.  
  32.       writeln('-----------------------------------');
  33.       writeln('SysLine FileName = ',SysInFileName);
  34.  
  35.       IF SysPgmTrace then pDelay1;
  36.  
  37.       (*------------------------------------------------------*)
  38.       (*        setup of global parms                         *)
  39.  
  40.       IF SysInFileName = '/F' then
  41.       (* enable File Entry module *)
  42.       (* gather no more command line parms *)
  43.       begin
  44.          (* enable the File Entry method : for FILE and PARMS *)
  45.          SysCmdLine := false ;     (* disable Line entry module *)
  46.          SysCmdFile := true  ;     (* enable  File entry module *)
  47.          (**)
  48.          SysCmdUser := true  ;     (* enable User Entry Module *)
  49.          SysCmdUserFile := false ; (* not get filename *)
  50.          SysCmdUserParm := true  ; (*     get parameters.       *)
  51.       end;
  52.  
  53.       If SysInFileName = '?' then
  54.       (* enable User Entry module *)
  55.       (* gather no more command line parms *)
  56.       begin
  57.          (* enable the User Entry method : for DOCS, FILE , PARMS *)
  58.          SysCmdLine := false ;    (* disable Line entry module *)
  59.          SysCmdFile := false ;    (* disable File entry module *)
  60.          (**)
  61.          SysCmdUser := true  ;    (* enable User Entry Module *)
  62.          SysCmdUserFile := true ; (* not get filename *)
  63.          SysCmdUserParm := true ; (* not get parameters *)
  64.       end;
  65.  
  66.       (*--------------------------------------------------------------*)
  67.       (*  now,                                                        *)
  68.       (*  flags are set, and program continues for Command Line Entry *)
  69.       
  70.       IF SysCmdLine then
  71.       begin (* continue to gather more parameters from command line *)
  72.          
  73.          (* single filename procedure *)
  74.          (* to be followed via Line Entry method *)
  75.          (* always defaults for looping through SysInSource[1.48] *)
  76.          SysInSourceCnt := 0;
  77.          SysInSourceMax := 1;
  78.          SysInSource[SysInSourceMax] := SysInFilename;
  79.          
  80.          
  81.          (*---> #2 parameter *) (* SysIndent *)
  82.          
  83.          IF length(paramstr(2)) > 0 then
  84.          begin
  85.             val(paramstr(2),SysIndentNum,xx);
  86.             SysIndent := true ;
  87.          end
  88.          ELSE  (* = 0 = missing *)
  89.          begin (* default *)
  90.             SysIndentNum := 3;  (* safe default *)
  91.             SysIndent := true;  (* always do an indent ! *)
  92.          end;
  93.  
  94.          SysIndentPos := 0; (* always *)
  95.          
  96.          
  97.          (*---> #3 paramter *) (* SysComment *)
  98.          
  99.          IF length(paramstr(3)) > 0
  100.          then
  101.          begin  (* normal *)
  102.             val(paramstr(3),SysCommentNum,xx);
  103.             (* parse selection entry *)
  104.             IF SysCommentNum = 1 then  (* normal *)
  105.             begin
  106.                SysComment := true;
  107.             end
  108.             ELSE (* SysCommentNum = 0 *)
  109.             begin
  110.                (* actively selected NO comment *)
  111.                SysComment := false;
  112.             end;
  113.          end
  114.          ELSE  (* = 0 *) (* normal *)
  115.          begin
  116.             (* safe default always *)
  117.             SysComment := true;
  118.          end;
  119.          
  120.          
  121.          (*---> #4 parameter *) (* SysLineCnt *) (* SysVertiate *)
  122.          
  123.          IF length(paramstr(4)) > 0
  124.          then
  125.          begin
  126.             val(paramstr(4),SysLineCntnum,xx);
  127.             IF SysLineCntNum = 1
  128.             then
  129.             begin
  130.                SysLineCnt := true ;
  131.                SysLenMax  := 75;
  132.                SysVertiate := true ;
  133.             end
  134.             ELSE  (* = 0 *)  (* normal *)
  135.             begin
  136.                SysLineCnt := false;  (* no line count numbers *)
  137.                SysLenMax  := 79;     (* page width *)
  138.                SysVertiate := false; (* no vertical filler markers *)
  139.             end;
  140.          end
  141.          ELSE  (* length(paramstr(4)) = 0 = missing *)
  142.          begin (* safe defaults always *)
  143.             SysLineCnt := false; (* produce running source code file *)
  144.             SysLenMax  := 79;    (* page widtth *)
  145.             SysVertiate := false;(* not fill blank lines with comment mark *)
  146.          end; (* #4 *)
  147.          
  148.          
  149.          (*---> check list for default settings *)
  150.          
  151.          (* have parm(1)
  152.          (* so :   file.typ, #, #, #   = 4
  153.          (* parameter counter must = 4
  154.          (* object for defaults : setup for writing running code
  155.          (**)
  156.          
  157.          (* should have caught all parameters entry/default by now !
  158.          (**)
  159.          
  160.       end; (* IF SysCmdLine *)
  161.       
  162.    end
  163.    ELSE  (* paramcount = 0 *)
  164.    begin
  165.  
  166.       (* command line should contain all incoming data *)
  167.       SysInFileName := '?';     (* enable Entry/Docs module *)
  168.       SysCmdLine := false ;     (*                           *)
  169.       SysCmdFile := false ;     (* disable File entry module *)
  170.       SysCmdUser := true  ;     (* enable  User Entry Module. *)
  171.       SysCmdUserFile := true  ; (*     get filename   from FIle *)
  172.       SysCmdUserParm := true  ; (*     get parameters from File *)
  173.  
  174.    end;
  175.  
  176.  
  177. END;  (* INCLUDE FILE *)
  178.  
  179. (*******************************************************************)
  180.  
  181. (*<<<>>>*)